<template>
<view class="yajin">
	<view style="margin-top: 168upx; text-align: center; font-size: 90upx; color: #18a3dc;">0.0</view>
	<view style="margin-top: 80upx; text-align: center; font-size: 32upx; color: #18a3dc;">总余额（元）</view>
	<view style="margin-top: 70upx; text-align: center; font-size: 24upx; color: #666666;">可随时在‘个人中心-我的钱包提现’</view>
	<view @click="jiaona" style="margin: 200upx auto 0; width: 670upx; height: 105upx; line-height: 105upx; text-align: center; font-size: 40upx; background-color: #18a3dc; color: #FFFFFF;">
		充值押金
	</view>
	<view style="height: 100upx;"></view>
</view>
</template>

<script>
import { HTTP } from '../../http.js';
let http = new HTTP;
export default {
	data() {
		return {
		}
	},
	methods: {
		changeSele(item){
			this.sele=item;
		},
		jiaona(){		
			let user = uni.getStorageSync('user');
			uni.showLoading({ title: '加载中' });
			http.request({
				url: `borrow/deposit?openId=${user.wxOpenId}`,
				method: 'post',
				success: (res)=>{
					uni.requestPayment({
						provider: 'wxpay',
						timeStamp: res.dataList.timeStamp,
						nonceStr: res.dataList.nonceStr,
						package: res.dataList.package,
						signType: 'MD5',
						paySign: res.dataList.paySign,
						success: (res)=>{						
							uni.hideLoading();				
							uni.navigateBack({ delta: 1, success: ()=>uni.showToast({ icon: 'none', title: '支付成功！', duration: 2000 }) });									
						},
						fail: (err)=>{				
							uni.hideLoading();						
							uni.showToast({ icon: 'none', title: '支付失败！', duration: 2000 });		
						}
					});					
				}
			});
		}
	}
}
</script>

<style>
.yajin {
	height: 100vh;
	position: relative;
	background: #fff;
	overflow: auto;
}
</style>
